import http from './http'

export interface LoginPayload {
  username: string
  password: string
}

export interface RegisterPayload {
  username: string
  email: string
  password: string
  confirmPassword?: string
}

export async function apiLogin(payload: LoginPayload) {
  return http.post('/api/auth/login', payload)
}

export async function apiRegister(payload: RegisterPayload) {
  return http.post('/api/auth/register', payload)
}

export async function apiCheckUsername(username: string) {
  return http.get('/api/auth/check-username', { params: { username } })
}
